Note: this notebook runs in R, not python.

To setup jupyter to run R, see:

  1. https://www.continuum.io/blog/developer/jupyter-and-conda-r
  2. https://github.com/IRkernel/IRkernel

Load the NADA package


In [1]:
library("NADA")


Loading required package: survival

Attaching package: 'NADA'

The following object is masked from 'package:stats':

    cor

Read in the data


In [2]:
main_columns = c(
    'epa_rain_zone', 'season', 'primary_landuse',
    'parameter', 'fraction', 'units', 'res', 'qual'
)
df = read.csv("nsqdata_example_subset.csv")[main_columns]
head(df)


Out[2]:
epa_rain_zoneseasonprimary_landuseparameterfractionunitsresqual
11springResidentialCadmiumTotalug/L10<
21springResidentialCadmiumTotalug/L10<
31springResidentialCadmiumTotalug/L10<
41springResidentialCadmiumTotalug/L10<
51springResidentialCadmiumTotalug/L1<
61springResidentialCadmiumTotalug/L1<

ROS the data and show the median


In [3]:
dfros = NADA::ros(df$res, df$qual=='<')
median(dfros)


Warning message:
In NADA::ros(df$res, df$qual == "<"): Dropped censored values that exceed max of uncensored values.
Out[3]:
0.351893483458947